<template>
	<view class="container">
		<view class="headimg"><image src="/static/success.png" mode="aspectFill"/></view>
		<view class="line">{{TipText}}</view>
		<view class="tip">请点击放大下方群二维码，放大后<br>长按该码即可识别入群！</view>
		<view class="ewm"><image :src="Ewm"  @click="PrevImg([Ewm], 0)"/></view>
		<view class="btn"><view class="home" @click="Home()">首页</view><view class="back" @click="Back()">{{BtnText}}</view></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				TipText:'操作成功',
				BtnText:'返回',
				Url:'',
				Ewm:'',
				Delta:1
			};
		},
		onLoad(options) {
			this.TipText=options.TipText;
			this.BtnText=options.BtnText;
			this.Url=options.Url;
			this.Ewm=options.Ewm;
			if(options.Delta){
				this.Delta= parseInt(options.Delta);
			}
		},
		methods:{
			Home(){
				uni.switchTab({
					url:'/pages/index/index',
				})
			},
			Back(){
				if(this.BtnText=="返回"){
					uni.navigateBack({
						delta:this.Delta
					})
				}
				else if(this.Url.indexOf("/index/index")>-1 || this.Url.indexOf("/category/category")>-1  || this.Url.indexOf("/bookbox/bookbox")>-1 || this.Url.indexOf("/my/my")>-1){
					uni.switchTab({
						url:this.Url
					})
				}else{
					uni.navigateTo({
						url:this.Url
					})
				}
			},
			PrevImg(urls,index){
				uni.previewImage({
					current:index,
					urls: urls,
					longPressActions: {
						itemList: ['保存图片'],
						success: data=> {
							uni.saveImageToPhotosAlbum({
								filePath: urls[data.index],
								success: d=> {
									this.Util.Toast("已保存至系统相册");
								}
							});
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	page{background-color: #ffffff;}
	.headimg{width:100%; height:auto; text-align:center; margin-top:40rpx; image{width:200rpx; height:200rpx;}}
	.line{width:100%; min-height:60rpx; line-height: 60rpx; text-align: center; font-size:46rpx; padding-left:30rpx; padding-right: 30rpx;}
	.tip{width:100%; height:120rpx; line-height: 46rpx; text-align:center; margin-top:40rpx; color:#007AFF;}
	.ewm{width:100%; height:430rpx; text-align:center;
		image{width:400rpx; height:400rpx;}
	}
	.btn{width:650rpx; height:80rpx; line-height: 80rpx;  display:flex; flex-direction: row; text-align: center; margin-left:50rpx; padding-left:40rpx; padding-right: 40rpx; font-size:34rpx; margin-top:20rpx;
		.home{width:310rpx; height:80rpx; border:1rpx solid #c8c8c8; color:#6b6b6b; background-color: #ffffff; border-radius:40rpx;}
		.back{width:310rpx; height:80rpx; margin-left:30rpx; border-radius:40rpx; background:linear-gradient(to right,#ff8d02,#ff5507); color:#ffffff;}
	}
</style>
